using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using TelnetExpect.Ntlm;

namespace TelnetTests
{
    [TestFixture]
    public class MySspiTests
    {
        [Test]
        public void One()
        {
            string result = MySspi.CreateSpn("telnet", "svr1", 23, 23);
            Assert.AreEqual("telnet/svr1", result);
        }

        [Test]
        public void Two()
        {
            string result = MySspi.CreateSpn("telnet", "svr2", 123, 23);
            Assert.AreEqual("telnet/svr2:123", result);
        }

        [Test]
        public void Three()
        {
            string result = MySspi.CreateSpn("foo", "svr2.example.com", 0, 99);
            Assert.AreEqual("foo/svr2.example.com", result);
        }

        [Test]
        public void ArgEx()
        {
            try {
                MySspi.CreateSpn(null, "svr2", 23, 23);
                Assert.Fail("should have thrown!");
            } catch (ArgumentException) {
            }
            try {
                MySspi.CreateSpn(string.Empty, "svr2", 23, 23);
                Assert.Fail("should have thrown!");
            } catch (ArgumentException) {
            }
            //
            try {
                MySspi.CreateSpn("telnet", null, 23, 23);
                Assert.Fail("should have thrown!");
            } catch (ArgumentException) {
            }
            try {
                MySspi.CreateSpn("telnet", string.Empty, 23, 23);
                Assert.Fail("should have thrown!");
            } catch (ArgumentException) {
            }
        }


    }
}
